package com.zking.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.text.ParseException;
import java.text.SimpleDateFormat;

@Controller
public class MyController1 {
    @RequestMapping({"/", "/index"})
    public String index() {
        return "index";
    }
    
    @RequestMapping("/t1")
    public String test1(Model model) {
        return "test";
    }
    
    @RequestMapping("/t2")
    public String test2(Model model) {
        return "test";
    }
    
    @RequestMapping("/t123")
    public String test123(Model model) {
        return "test";
    }
    
    @RequestMapping("/t3/{id}")
    public String test3(Model model, @PathVariable int id) {
        model.addAttribute("id", id);
        return "test";
    }
    
    @RequestMapping("/t3/{id}/user")
    public String test33(Model model, @PathVariable int id) {
        System.out.println(Integer.valueOf("1.23sss")); // 格式异常
        String s = null;
        System.out.println(s.length()); // 空指针
        model.addAttribute("id", 1 / id); // 数学异常
        return "test";
    }
}
